/**
 * 
 */
package com.wutianyi.json;

import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;


/**
 * @author wutianyi
 *
 */
public class Json {
	
	public static void main(String[] args) throws JsonGenerationException, JsonMappingException, IOException {
		ObjectMapper mapper = new ObjectMapper();
		Map<String, Object>map = new HashMap<String, Object>();
		map.put("num", 1);
		map.put("integer", 1);
		map.put("decimal", 2);
		System.out.println(mapper.writeValueAsString(map));
		StringWriter writer = new StringWriter();
		mapper.writeValue(writer, map);
		System.out.println(writer);
		
	}
}
